﻿<UserControl x:Class="ExORMDesginer.UserControls.DatabaseExplorerView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:s="clr-namespace:DiagramDesigner"
        xmlns:UC="clr-namespace:ExORMDesginer.UserControls"
        xmlns:editer="clr-namespace:ExORMDesginer.UserControls.CCodeEditer"
        xmlns:local="clr-namespace:ExORMDesginer.Helper"
        mc:Ignorable="d" 
        d:DesignHeight="600" d:DesignWidth="800" Loaded="UserControl_Loaded_1">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="29" />
            <RowDefinition Height="577*" />
        </Grid.RowDefinitions>
        <telerik:RadMenu Grid.Row="0" Panel.ZIndex="999" >
            <telerik:RadMenuItem Header="文件">
                <telerik:RadMenuItem Header="打开"/>
                <telerik:RadMenuItem Header="保存"/>
            </telerik:RadMenuItem>
            <telerik:RadMenuItem Header="编辑">
                <telerik:RadMenuItem Header="复制" Command="{Binding CopyCommand}"/>
                <telerik:RadMenuItem Header="粘贴"/>
            </telerik:RadMenuItem>

            <telerik:RadMenuItem Header="SQL-MAP">
                <telerik:RadMenuItem Header="新建查询" Command="{Binding AddTabCommand}" />
                <telerik:RadMenuItem Header="分析参数" Command="{Binding ParseSQLCommand}" />
                
            </telerik:RadMenuItem>
            <telerik:RadMenuItem Header="运行" Command="{Binding DebugCommand}">
            </telerik:RadMenuItem>
        </telerik:RadMenu>
        <telerik:RadDocking ContextMenu="{x:Null}"  Grid.Row="1"  BorderThickness="0"  HasDocumentHost="True" HorizontalAlignment="Stretch" Name="radDocking1" VerticalAlignment="Stretch" Grid.RowSpan="2" >
            <telerik:RadSplitContainer InitialPosition="DockedLeft">
                <telerik:RadPaneGroup Name="radPaneGroup1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <telerik:RadPane Header="SQL-MAP列表" CanUserClose="False" ContextMenuTemplate="{x:Null}">

                        <telerik:RadTreeView ItemsSource="{Binding SqlMapList}"  SelectedItem="{Binding Model.CurrentSqlMapItem,Mode=TwoWay}">
                         
                            <telerik:RadTreeView.ContextMenu>
                                <ContextMenu   Foreground="Black">
                                    <MenuItem Header="设计" Command="{Binding AddTabCommand}"/>
                                </ContextMenu>
                            </telerik:RadTreeView.ContextMenu>
                            <telerik:RadTreeView.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <TextBlock Text="{Binding Name}">
                                            <TextBlock.ToolTip>
                                                <TextBlock Text="{Binding Memo}"/>
                                            </TextBlock.ToolTip>
                                        </TextBlock>
                                    </StackPanel>
                                </DataTemplate>
                            </telerik:RadTreeView.ItemTemplate>
                        </telerik:RadTreeView>
                    </telerik:RadPane>

                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="DockedBottom">
                <telerik:RadPaneGroup HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <telerik:RadPane  Header="参数" CanUserClose="False" ContextMenuTemplate="{x:Null}">
                        <ContentControl Content="{Binding ParametersViewModel.View}"/>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <telerik:RadPane  Header="结果" CanUserClose="False" ContextMenuTemplate="{x:Null}">
                        <telerik:RadGridView AutoGenerateColumns="True" ShowGroupPanel="False" ItemsSource="{Binding ResultData}"/>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>

            <telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer>
                    <telerik:RadPaneGroup Name="radDock" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                        local:PaneGroupExtensions.ItemsSource="{Binding SQLEditerTabs}"
                        local:PaneGroupExtensions.ItemTitleDisplayMemberPath="Title"
                        SelectedIndex="{Binding TabIndex}" >
                    
                        <local:PaneGroupExtensions.ItemHeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Title,Mode=TwoWay}" />
                            </DataTemplate>
                        </local:PaneGroupExtensions.ItemHeaderTemplate>

                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking.DocumentHost>

        </telerik:RadDocking>
    </Grid>
</UserControl>
